import request from '@/utils/request';

/**
 * 获取所有的表
 * @param params
 * @returns
 */
export async function GetTables(params: any) {
  return request('/api/generator/tables', {
    method: 'POST',
    data: params,
  });
}

/**
 * 获取表对应的列
 * @param params
 * @returns
 */
export async function getColumns(params: any) {
  return request('/api/generator/columns', {
    method: 'POST',
    data: params,
  });
}

/**
 * 同步表格的属性
 * @param params
 * @returns
 */
export async function syncColumns(params: any) {
  return request('/api/generator/sync', {
    method: 'POST',
    data: params,
  });
}

/**
 * 获取配置
 * @param params
 * @returns
 */
export async function genConfig(params: any) {
  return request('/api/generator/genConfig', {
    method: 'POST',
    data: params,
  });
}

/**
 * 更新配置
 * @param params
 * @returns
 */
export async function updateConfig(params: any) {
  return request('/api/generator/updateConfig', {
    method: 'POST',
    data: params,
  });
}

/**
 *
 * @param params 下载
 * @returns
 */
export async function genOrDownload(params: any) {
  return request('/api/generator/genOrDownload', {
    method: 'POST',
    responseType: 'blob',
    data: params,
  });
}

/**
 *
 * @param params 代码生成
 * @returns
 */
export async function gen(params: any) {
  return request('/api/generator/genOrDownload', {
    method: 'POST',
    data: params,
  });
}
